//
//
//  Created by chao on 16/7/29.
//  Copyright © 2016年 chao. All rights reserved.
//

#import "BaseNavigationController.h"

@interface BaseNavigationController ()

@end

@implementation BaseNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    // 清空导航条背景图片
    [self.navigationBar setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
    [self.navigationBar setShadowImage:[[UIImage alloc] init]];
    self.navigationBar.translucent = NO;
    self.navigationBar.barTintColor = [UIColor colorWithRed:0.98 green:0.80 blue:0.24 alpha:1.00];
}

- (UIStatusBarStyle)preferredStatusBarStyle {
    return UIStatusBarStyleDefault;
}



- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    if (self.viewControllers.count > 0) {
        viewController.hidesBottomBarWhenPushed = YES;
    }
    [super pushViewController:viewController animated:animated];
}


+(BaseNavigationController*)BaseNavigationControllerGetWithRootViewController:(UIViewController*)rootVC andimageName:(NSString*)imageName andTitle:(NSString*)title andTag:(NSInteger)tag{
    BaseNavigationController* res = [[BaseNavigationController alloc]initWithRootViewController:rootVC];
    res.tabBarItem.image = [UIImage imageNamed:imageName];
    res.tabBarItem.selectedImage = [[UIImage imageNamed:[NSString stringWithFormat:@"%@HL",imageName]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    rootVC.title = title;
    res.view.tag = tag;
    [rootVC.navigationItem setTitle:title];
    return res;
}



@end
